home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / Editors / emacs / Emacs-1.14b1 / lisp / mac / Dialogs.el < prev    next >
Encoding:
Text File  |  1994-02-21  |  4.2 KB  |  161 lines  |  [TEXT/EMAC]

  1. ;;;
  2. ;;; This file is part of a Macintosh port of GNU Emacs.
  3. ;;;
  4. ;;; GNU Emacs is distributed in the hope that it will be useful,
  5. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  6. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  7. ;;; GNU General Public License for more details.
  8. ;;;
  9.  
  10. (defvar dialog-user-item-callback-proc-list nil)
  11.  
  12. (defun dialog-user-item-callback (d item)
  13.   (let ((callback (assoc item dialog-user-item-callback-proc-list)))
  14.     (if callback
  15.         (condition-case errmsg
  16.             (funcall (cdr callback) d item)
  17.           (error
  18.            nil)))))
  19.  
  20. ; pascal DialogPtr GetNewDialog(short dialogID,void *dStorage,WindowPtr behind)
  21. ; = 0xA97C; 
  22. (deftrap GetNewDialog ("a97c")
  23.   ((dialogID short)
  24.    (dStorage long)
  25.    (behind long))
  26.   long)
  27.  
  28. ; pascal void ModalDialog(ModalFilterProcPtr filterProc,short *itemHit)
  29. ; = 0xA991; 
  30. (deftrap ModalDialog-internal ("a991")
  31.   ((filterProc long)
  32.    (itemHit address))
  33.   nil)
  34.  
  35. (setq modal-dialog-filter-proc nil)
  36.  
  37. (defun modal-dialog-filter-callback (d e i)
  38.   (condition-case errmsg
  39.       (funcall modal-dialog-filter-proc d e i)
  40.     (error
  41.      nil)))
  42.  
  43. (defun ModalDialog (filterProc itemHit)
  44.   (if (and (integerp filterProc) (zerop filterProc))
  45.       (ModalDialog-internal 0 itemHit)
  46.     (setq modal-dialog-filter-proc filterProc)
  47.     (ModalDialog-internal modal-dialog-filter-callback itemHit)))
  48.  
  49. ; pascal short Alert(short alertID,ModalFilterProcPtr filterProc)
  50. ;  = 0xA985; 
  51. (deftrap Alert-internal ("a985")
  52.   ((alertID short)
  53.    (filterProc long))
  54.   short)
  55.  
  56. (defun Alert (alertID filterProc)
  57.   (if (and (integerp filterProc) (zerop filterProc))
  58.       (Alert-internal alertID 0)
  59.     (setq modal-dialog-filter-proc filterProc)
  60.     (Alert-internal alertID modal-dialog-filter-callback)))
  61.  
  62. ; pascal short StopAlert(short alertID,ModalFilterProcPtr filterProc)
  63. ;  = 0xA986;
  64. (deftrap StopAlert-internal ("a986")
  65.   ((alertID short)
  66.    (filterProc long))
  67.   short)
  68.  
  69. (defun StopAlert (alertID filterProc)
  70.   (if (and (integerp filterProc) (zerop filterProc))
  71.       (StopAlert-internal alertID 0)
  72.     (setq modal-dialog-filter-proc filterProc)
  73.     (StopAlert-internal alertID modal-dialog-filter-callback)))
  74.  
  75. ; pascal short NoteAlert(short alertID,ModalFilterProcPtr filterProc)
  76. ;  = 0xA987;
  77. (deftrap NoteAlert-internal ("a987")
  78.   ((alertID short)
  79.    (filterProc long))
  80.   short)
  81.  
  82. (defun NoteAlert (alertID filterProc)
  83.   (if (and (integerp filterProc) (zerop filterProc))
  84.       (NoteAlert-internal alertID 0)
  85.     (setq modal-dialog-filter-proc filterProc)
  86.     (NoteAlert-internal alertID modal-dialog-filter-callback)))
  87.  
  88. ; pascal short CautionAlert(short alertID,ModalFilterProcPtr filterProc)
  89. ;  = 0xA988;
  90. (deftrap CautionAlert-internal ("a988")
  91.   ((alertID short)
  92.    (filterProc long))
  93.   short)
  94.  
  95. (defun CautionAlert (alertID filterProc)
  96.   (if (and (integerp filterProc) (zerop filterProc))
  97.       (CautionAlert-internal alertID 0)
  98.     (setq modal-dialog-filter-proc filterProc)
  99.     (CautionAlert-internal alertID modal-dialog-filter-callback)))
  100.  
  101. ; pascal void DisposeDialog(DialogPtr theDialog)
  102. ; = 0xA983; 
  103. (deftrap DisposeDialog ("a983")
  104.   ((theDialog long))
  105.   nil)
  106.  
  107. ;pascal void GetDItem(DialogPtr theDialog,short itemNo,short *itemType,Handle *item,
  108. ; Rect *box)
  109. ; = 0xA98D; 
  110. (deftrap GetDItem ("a98d")
  111.   ((theDialog long)
  112.    (itemNo short)
  113.    (itemType address)
  114.    (item address)
  115.    (box address))
  116.   nil)
  117.  
  118. ;pascal void SetDItem(DialogPtr theDialog,short itemNo,short itemType,Handle item,
  119. ; const Rect *box)
  120. ; = 0xA98E; 
  121. (deftrap SetDItem ("a98e")
  122.   ((theDialog long)
  123.    (itemNo short)
  124.    (itemType short)
  125.    (item address)
  126.    (box address))
  127.   nil)
  128.  
  129. ; pascal void SetIText(Handle item,ConstStr255Param text)
  130. ;  = 0xA98F; 
  131. (deftrap SetIText ("a98f")
  132.   ((item address)
  133.    (text address))
  134.   nil)
  135.  
  136. ; pascal void GetIText(Handle item,Str255 text)
  137. ;  = 0xA990; 
  138. (deftrap GetIText ("a990")
  139.   ((item address)
  140.    (text address))
  141.   nil)
  142.  
  143. ; pascal void SelIText(DialogPtr theDialog,short itemNo,short strtSel,short endSel)
  144. ;  = 0xA97E; 
  145. (deftrap SelIText ("a97e")
  146.   ((theDialog long)
  147.    (itemNo short)
  148.    (strtSel short)
  149.    (endSel short))
  150.   nil)
  151.  
  152. ; pascal void ParamText(ConstStr255Param param0,ConstStr255Param param1,ConstStr255Param param2,
  153. ;  ConstStr255Param param3)
  154. ; = 0xA98B; 
  155. (deftrap ParamText ("a98b")
  156.   ((param0 address)
  157.    (param1 address)
  158.    (param2 address)
  159.    (param3 address))
  160.   nil)
  161.